<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\admin\controller;

/**
 * 老师控制器
 */
class Teacher extends AdminBase
{
    
    /**
     * 老师列表
     */
    public function articleList()
    {
        
        $where = $this->logicTeacher->getWhere($this->param);

        $this->assign('list', $this->logicTeacher->getArticleList($where, 'a.*', 'a.create_time desc'));
        
        return $this->fetch('article_list');
    }
    
    /**
     * 老师添加
     */
    public function articleAdd()
    {
        
        $this->articleCommon();
        
        return $this->fetch('article_edit');
    }
    
    /**
     * 老师编辑
     */
    public function articleEdit()
    {
        
        $this->articleCommon();
        
        $info = $this->logicTeacher->getArticleInfo(['a.id' => $this->param['id']], 'a.*');
        

        
        $this->assign('info', $info);
        
        return $this->fetch('article_edit');
    }
    
    /**
     * 老师添加与编辑通用方法
     */
    public function articleCommon()
    {
        
//      IS_POST && $this->jump($this->logicTeacher->articleEdit($this->param));
        IS_POST && $this->jump($this->logicTeacher->articleEdit($_POST));


    }
    

    
    /**
     * 数据状态设置
     */
    public function setStatus()
    {
        
            $this->jump($this->logicAdminBase->setStatus('CourseTeacher', $this->param));
    }

    /**
     * 数据状态设置
     */
    public function update_info()
    {

        $this->jump($this->logicTeacher->update_info( $this->param));
    }
}
